package war
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	/**
	 * 图片的切割
	 * @author war
	 * 
	 */	
	public class PicCut extends Sprite
	{
		private var bd:BitmapData;
		public var arr:Array = [];
		private var xp:Number ;
		private var yp:Number ;
		private var numX:int=9
		private var numY:int=6;
		public function PicCut()
		{
			super();
			bd=new Png();
			for (var j:int = 0; j < numY; j++)
			{
				for (var i:int = 0; i < numX; i++)
				{
					xp = bd.width / numX*i;
					yp = bd.height / numY*j;
					var bmd:BitmapData = new BitmapData(bd.width,bd.height,true,0);
					bmd.copyPixels(bd,new Rectangle(xp,yp,bd.width / numX,bd.height / numY),new Point  );
					var bm:Bitmap = new Bitmap(bmd);
					arr.push(bm);
					/*addChild(bm);
					bm.x=i*25;
					bm.y=j*27;*/
				}				
			}
			bd.dispose();
			
		}
	}
}